<?php

namespace App\Model;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Http\Request;

/**
 * Class CardVideoIntroductions
 *
 * @package App\Model
 * @method static bool|null forceDelete()
 * @method static \Illuminate\Database\Query\Builder|\App\Model\CardVideoIntroductions onlyTrashed()
 * @method static bool|null restore()
 * @method static \Illuminate\Database\Query\Builder|\App\Model\CardVideoIntroductions withTrashed()
 * @method static \Illuminate\Database\Query\Builder|\App\Model\CardVideoIntroductions withoutTrashed()
 * @mixin \Eloquent
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\CardVideoIntroductions newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\CardVideoIntroductions newQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\CardVideoIntroductions query()
 * @property int $id 主键
 * @property int $user_id 名片id
 * @property string $title 标题
 * @property string|null $content 内容
 * @property string $video_url 视频地址
 * @property \Illuminate\Support\Carbon $created_at 创建时间
 * @property \Illuminate\Support\Carbon $updated_at 修改时间
 * @property \Illuminate\Support\Carbon|null $deleted_at 删除时间
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\CardVideoIntroductions whereContent($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\CardVideoIntroductions whereCreatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\CardVideoIntroductions whereDeletedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\CardVideoIntroductions whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\CardVideoIntroductions whereTitle($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\CardVideoIntroductions whereUpdatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\CardVideoIntroductions whereUserId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\CardVideoIntroductions whereVideoUrl($value)
 */
class CardVideoIntroductions extends Model
{
    use SoftDeletes;

    protected $table = 'card_video_introductions';

    protected $primaryKey = 'id';

    protected $dates = ['deleted_at'];

    public function add(Request $request)
    {
        $data = $request->input();
        $this->user_id = $request->user()->id;
        $this->title = $data['title'];
        $this->content = $data['content'];
        $this->video_url = $data['url'];
        return $this->save();
    }

}
